#include<stdio.h>
#include<fcntl.h>
#include<errno.h>
#include<unistd.h>
#include<sys/ioctl.h>

//定义一下自己的cmd编码
#define CMD 0x24
#define CMD0		_IO(CMD,0x00)
#define CMD1		_IO(CMD,0x01)
#define CMD2		_IO(CMD,0x02)
#define CMD3		_IO(CMD,0x03)

int main()
{
	int ret = 0;
	char buf[10] = "hello";
    int dev_fd = open("/dev/ioctl_interface", O_RDWR);
	if(dev_fd < 0){
		perror("open failed");
		return 0;
	}

	//第一个参数是文件描述符，第二个参数是cmd编码，第三个参数可以填一个内存地址交给内核
    ioctl(dev_fd, CMD0, buf);
    ioctl(dev_fd, CMD1, NULL);
	ioctl(dev_fd, CMD2, NULL);
	ioctl(dev_fd, CMD3, NULL);

    close(dev_fd);
	return 0;
}